package com.kaoqin.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.kaoqin.mapper.ProjectMapper;
import com.kaoqin.model.Project;
import com.kaoqin.service.ProjectService;

/**
 * @ClassName: ProjectServiceImpl
 * @Description: 项目查询
 * @author: Janus
 * @date: 2017-7-27 下午4:43:16
 */
@Service("projectService")
@Transactional
public class ProjectServiceImpl implements ProjectService {
	@Autowired
	private ProjectMapper mapper;

	@Override
	public List<Project> findAll(String proCode) throws RuntimeException {
		// TODO Auto-generated method stub
		return mapper.findAll(proCode);
	}

	@Override
	public Map<String, String> packageCodeAndName() throws RuntimeException {
		List<Project> findAll = mapper.findAll(null);
		Map<String,String> peoMap = new HashMap<>();
		for (Project project : findAll) {
			peoMap.put(project.getProjectCode(), project.getProjectName());
		}
		return peoMap;
	}
}
